
	var webApp = new Vue({
		el: '#webApp',
		data: {
			contentClass: -1,
			pageTotal: 3,
			nav: [{
				name: '首页',
				link: 'javaScript:void'
			}, {
				name: '最新活动',
				link: 'javaScript:void'
			}, {
				name: '农场产品',
				link: 'javaScript:void'
			}, {
				name: '服务市场',
				link: 'javaScript:void'
			}, {
				name: '解决方案',
				link: 'javaScript:void'
			}, {
				name: '云市场',
				link: 'javaScript:void'
			}, {
				name: '大数据',
				link: 'javaScript:void'
			}, {
				name: '社区',
				link: 'javaScript:void'
			}],
			classify: [{
				img: './img/fruits.png',
				name: '分类',
				link: 'javaScript:void'
			}, {
				img: './img/fruits.png',
				name: '分类',
				link: 'javaScript:void'
			}, {
				img: './img/fruits.png',
				name: '分类',
				link: 'javaScript:void'
			}, {
				img: './img/fruits.png',
				name: '分类',
				link: 'javaScript:void'
			}, {
				img: './img/fruits.png',
				name: '分类',
				link: 'javaScript:void'
			}],
			picks: [{
				img: './img/orange.png',
				tag: '柑橘',
				company: '三峡农夫',
				companyExplain: '三峡农夫种植柑橘',
				pic: '23.99'
			}, {
				img: './img/orange.png',
				tag: '柑橘',
				company: '三峡农夫',
				companyExplain: '三峡农夫种植柑橘',
				pic: '23.99'
			}, {
				img: './img/orange.png',
				tag: '柑橘',
				company: '三峡农夫',
				companyExplain: '三峡农夫种植柑橘',
				pic: '23.99'
			}, {
				img: './img/orange.png',
				tag: '柑橘',
				company: '三峡农夫',
				companyExplain: '三峡农夫种植柑橘',
				pic: '23.99'
			}, {
				img: './img/orange.png',
				tag: '柑橘',
				company: '三峡农夫',
				companyExplain: '三峡农夫种植柑橘',
				pic: '23.99'
			}, ]
		},
		mounted() {
			setTimeout(() => {
				this.contentClass = 0
			}, 300)
		},
		watch: {
			contentClass: function(val) {
				if (val == 0) {
					for (i = 0; i <= 10; i++) {
						setTimeout(() => {
							$('.welcomeBox').css('opacity', `${i/10}`)
						}, 500)
					}
					setTimeout(() => {
						$('.welcomeBox').css('bottom', '0.77rem')
					}, 300)
				} else {
					$('.welcomeBox').css('opacity', '0').css('bottom', '0.2rem')
				}
			}
		},
		methods: {

		}
	})

	function wheel() {
		var time = new Date().getTime()
		const scrollFunc = function(e) {
			e = e || window.event;
			let gt = new Date().getTime() - time
			if (gt < 500) {
				return
			}
			var docClass = $('#content').attr('class')
			if (e.wheelDelta > 0) {
				// 鼠标向上滚动
				if (webApp.$data.contentClass > 0) {
					webApp.$data.contentClass -= 1
				}
			} else {
				// 鼠标向下滚动
				if (webApp.$data.contentClass < webApp.$data.pageTotal - 1) {
					webApp.$data.contentClass += 1
				}
			}
			time = new Date().getTime()
		}
		/*注册事件*/
		if (document.addEventListener) {
			document.addEventListener('DOMMouseScroll', scrollFunc, false);
		} //W3C
		window.onmousewheel = document.onmousewheel = scrollFunc; //IE/Opera/Chrome
	}
	wheel()
	//监听键盘按下时的事件
	$(document).keydown(function(event) {
		let code = event.keyCode
		if (code == 40) {
			if (webApp.$data.contentClass < webApp.$data.pageTotal - 1) {
				webApp.$data.contentClass += 1
			}
		} else if (code == 38) {
			if (webApp.$data.contentClass > 0) {
				webApp.$data.contentClass -= 1
			}
		}
	});